home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 262 / SOMC Family Forum 262.iso / Xtras / Widget Wizard / Widget Wizard.dir / WidgtBehaviors_82_Open Movie in a Window.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  3.9 KB  |  117 lines

  1. property windowLeft, windowTop, windowWidth, windowHeight, windowMovie, windowName, windowType, scrollable, sizable, zoomable, invisible, whichevent
  2.  
  3. on triggerOpenMIAW me
  4.   trigger(me)
  5. end
  6.  
  7. on mouseUp me
  8.   if whichevent = #mouseUp then
  9.     trigger(me)
  10.   end if
  11. end
  12.  
  13. on prepareFrame me
  14.   if whichevent = #prepareFrame then
  15.     trigger(me)
  16.   end if
  17. end
  18.  
  19. on exitFrame me
  20.   if whichevent = #exitFrame then
  21.     trigger(me)
  22.   end if
  23. end
  24.  
  25. on trigger me
  26.   set w to get_previous_instance(the windowList, the windowName of me)
  27.   if objectp(w) then
  28.     forget(w)
  29.   end if
  30.   if the windowName of me <> EMPTY then
  31.     set w to window the windowName of me
  32.     set the titleVisible of w to 1
  33.   else
  34.     set w to window "temp"
  35.     set the titleVisible of w to 0
  36.   end if
  37.   set the fileName of w to get_filename(the windowMovie of me)
  38.   set the windowType of w to get_window_style(me)
  39.   set the rect of w to rect(the windowLeft of me, the windowTop of me, the windowLeft of me + the windowWidth of me, the windowTop of me + the windowHeight of me)
  40.   open(w)
  41. end
  42.  
  43. on get_previous_instance w_list, w_name
  44.   repeat with i = count(w_list) down to 1
  45.     set w to getAt(w_list, i)
  46.     if the name of w = w_name then
  47.       return w
  48.     end if
  49.   end repeat
  50.   return -1
  51. end
  52.  
  53. on get_window_style me
  54.   case the windowType of me of
  55.     #Document:
  56.       set zoomable to 0
  57.       if the zoomable of me then
  58.         if the sizable of me then
  59.           set t to 8
  60.         else
  61.           set t to 12
  62.         end if
  63.       else
  64.         if the sizable of me then
  65.           set t to 0
  66.         else
  67.           set t to 4
  68.         end if
  69.       end if
  70.     #palette:
  71.       set t to 49
  72.     #Rounded:
  73.       set t to 16
  74.     #plain:
  75.       set t to 2
  76.     #shadow:
  77.       set t to 3
  78.     "Modal Dialog":
  79.       set t to 1
  80.     "Movable Modal Dialog":
  81.       set t to 5
  82.     otherwise:
  83.       set t to 4
  84.   end case
  85.   return t
  86. end
  87.  
  88. on get_filename f_name
  89.   if not (f_name contains ".dir") then
  90.     set f_name to f_name & ".dir"
  91.   end if
  92.   if (f_name contains "/") or (f_name contains "\") then
  93.     if not f_name contains ":" then
  94.       set f_name to the pathName & f_name
  95.     end if
  96.   end if
  97.   return f_name
  98. end
  99.  
  100. on getPropertyDescriptionList
  101.   set p_list to [#windowMovie: [#comment: "Movie Name:", #format: #string, #default: EMPTY], #windowName: [#comment: "Window Name:", #format: #string, #default: EMPTY], #windowType: [#comment: "Window Style:", #format: #symbol, #range: [#Document, #palette, #Rounded, #plain, #shadow, "Modal Dialog", "Movable Modal Dialog"], #default: #Document], #sizable: [#comment: "Resize Box:", #format: #boolean, #default: 0], #windowLeft: [#comment: "Left:", #format: #integer, #default: 100], #windowTop: [#comment: "Top:", #format: #integer, #default: 100], #windowWidth: [#comment: "Width:", #format: #integer, #default: 0], #windowHeight: [#comment: "Height:", #format: #integer, #default: 0], #whichevent: [#comment: "Triggering Event:", #format: #symbol, #range: [#mouseUp, #prepareFrame, #exitFrame], #default: #mouseUp]]
  102.   return p_list
  103. end
  104.  
  105. on endSprite me
  106.   forget(window windowName)
  107. end
  108.  
  109. on getAssocMembers
  110.   set myPropList to [windowMovie]
  111.   return myPropList
  112. end
  113.  
  114. on getBehaviorDescription
  115.   return "Opens an independent Director Movie in a Window of the designated type." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Movie Name - filename of movie to be opened." & RETURN & "ΓÇó Window Name - ( optional ) label to be displayed in window header, when visible." & RETURN & "ΓÇó Window Style - border style and interactivity options." & RETURN & "ΓÇó Resize Box - make window resizable when appropriate." & RETURN & "ΓÇó Left, Top - initial offset ( in pixels ) of the window from the upper left corner of the display." & RETURN & "ΓÇó Width, Height - ( optional ) initial dimensions ( in pixels ) of the window." & RETURN & "ΓÇó Triggering Event - event that will open the movie." & RETURN & "MESSAGES:" & RETURN & "ΓÇó Trigger - open a window using the current parameters."
  116. end
  117.